package org.springframework.learn.beans.note.matadata;

import org.springframework.core.io.Resource;
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.core.type.classreading.CachingMetadataReaderFactory;
import org.springframework.core.type.classreading.MetadataReader;
import org.springframework.core.type.classreading.MetadataReaderFactory;

import java.io.IOException;

/**
 * metadata相关API
 * @author chenjiquan
 * @date 2024-01-15
 */
public class MetaDataNote {
	public static void main(String[] args) throws IOException {
		MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory();
		String className = "";
		AnnotationMetadata metadata;
		// 根据className获取MetadataReader对象
		MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(className);
		// 读取底层类的完整注解元数据，包括带注解方法的元数据
		metadata = metadataReader.getAnnotationMetadata();
		// ========================================================================
		String beanName = "";
//		new ConfigurationClass(metadataReader, beanName);
		// ========================================================================
		Resource resource = null;
		// 根据resource获取MetadataReader对象
		MetadataReader metadataReader1 = metadataReaderFactory.getMetadataReader(resource);
		metadataReader1.getClassMetadata();
		metadataReader1.getResource();
		metadataReader1.getAnnotationMetadata();
	}
}
